import { getTaxDet } from "@/static/js/law.js";
export default {
  data() {
    return {
      showLoad: false,
      type: "",
      details: {},
      showMore: false,
      showFontSize: false,
      fontSizeIndex: 0,
      fontSize: "28rpx",
      showParse: true,
      contentTopHeight: 0, //盒子高度
      menuList: [],
    };
  },
  methods: {
    //获取详细信息
    getInfo(id) {
      uni.showToast({
        title: "加载中",
        icon: "loading",
      });
      let data = {
        id: id,
      };
      if (this.type != "") {
        data.type = this.type;
      }
      getTaxDet({
        ...data,
      })
        .then((res) => {
          if (res.code == 1) {
            uni.hideLoading();
            console.log(res);
            this.details = res.data;
            this.showLoad = true;
          } else {
            this.$tools.showToast(res.msg);
          }
        })
        .catch((err) => {
          console.log("错误回调", err);
        });
    },

    //关闭弹框
    close() {
      this.showMore = false;
    },

    //获取当前元素高度
    getElementHeight() {
      setTimeout(() => {
        uni
          .createSelectorQuery()
          .select("#content_top") // 需要获取的元素选择器
          .fields({ size: true }, (res) => {
            console.log(res);
            let height = res.height;
            this.contentTopHeight = Math.ceil(height) * 2 + 200;
          })
          .exec();
      }, 500);
    },
  },
  computed: {
    fontSizeLeft: function () {
      return `primary${this.fontSizeIndex + 1}`;
    },
  },
  onLoad(e) {
    let { id, type } = e;
    this.type = type ? type : "";
    this.getInfo(id);
  },
  onReady() {
    this.getElementHeight();
  },
};